home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Games Machine 76
/
XENIATGM66.iso
/
Indiana Jones
/
Indiana Jones.exe
/
RESOURCE
/
PREVIEW.GOB
/
cog_gen_dooroneway.cog
< prev
next >
Wrap
Text File
|
1999-11-15
|
2KB
|
114 lines
# Jones 3D Cog Script
#
# gen_DoorOneWay.cog
#
# 1-way Door Script. Depends on player being in ONE particular sector
# to open the door. Not usable in multiplayer.
# Added user0 message to allow door to be opened by outside script.
#
# [RD]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
# ========================================================================================
symbols
message startup
message activated
message arrived
message blocked
message timer
message user0
thing door
thing player local
sector inside // The sector that the door is opened from
sector doorsector local
flex movespeed=8.0
flex sleeptime=2.0
int locked=0 local
# subroutines
flex opendoor=0.0 local
end
# ========================================================================================
code
startup:
doorsector = GetThingSector(door);
SetSectorAdjoins(doorsector, 0);
return;
# ........................................................................................
activated:
if (IsThingMoving(door)) return;
if (locked) return;
if (GetThingSector(GetLocalPlayerThing()) == inside)
{
call opendoor;
}
else
{
locked = 1;
// PlaySoundLocal(locked0[(Rand() * 2)], 1, 0.0, 0);
// jkPrintUNIString(-1, 1001);
SetTimer(.8);
}
return;
# ........................................................................................
user0:
call opendoor;
return;
# ........................................................................................
opendoor:
SetSectorAdjoins(doorsector, 1);
locked = 1;
MoveToFrame(door, 1, movespeed);
return;
# ........................................................................................
arrived:
if (GetCurFrame(door) == 0)
{
SetSectorAdjoins(doorsector, 0);
locked = 0;
}
else
{
SetTimer(sleeptime);
}
return;
# ........................................................................................
blocked:
MoveToFrame(door, 1, movespeed);
return;
# ........................................................................................
timer:
if (GetCurFrame(door) == 1)
{
MoveToFrame(door, 0, movespeed);
}
else
{
locked = 0;
}
return;
end